<include file="../header" />
<div id="left-sider"><include file="../left-sider" /></div>
<div id="main">
  <div class="main-hd">
    <h2>职员管理</h2>
  </div>
  <div class="main-bd">
  <form id="staffToDelForm" action="remove" method="post" target="_self">
    <div>
      <p>
        <input type="submit" value="删除" />
        <a href="create">新增</a></p>
    </div>
    <div>
      <table width="100%" border="1" class="table-list">
        <tr>
          <th><input type="checkbox" id="staffToDelCtrl"/></th>
          <th>Name</th>
          <th>Position</th>
          <th>Mobile</th>
          <th>Email</th>
          <th>Queue</th>
          <th>Language</th>
        </tr>
        <volist name="staffs" id="staff">
          <tr>
            <td class="text-center"><input class="staffToDel" type="checkbox" name="staffToDel[]" value="{$staff.id}"/></td>
            <td><a href="edit/id/{$staff.id}" target="_self">{$staff.name}</a></td>
            <td>{$staff.position}</td>
            <td>{$staff.mobile}</td>
            <td>{$staff.email}</td>
            <td>{$staff.queue}</td>
            <td>{$staff.lang}</td>
          </tr>
        </volist>
      </table>
    </div>
    </div>
  </form>
</div>
<include file="../footer" /> 
<script type="text/javascript">
var staffToDel = document.querySelectorAll('.staffToDel');
document.getElementById('staffToDelCtrl').addEventListener('click',function(){
		if(this.checked) {
			for(var i=0; i<staffToDel.length; i++) {
				staffToDel[i].checked = true;
			}
		} else {
			for(var i=0; i<staffToDel.length; i++) {
				staffToDel[i].checked = false;
			}
		}
}, false);

document.getElementById('staffToDelForm').addEventListener('submit',function(e){
		if(!confirm('删除后无法恢复，你是否要继续？')) {
				e.preventDefault();
				return false;
		}
}, false);
</script>